import Vue from 'vue';
import Vuex from 'vuex';
import { RootState } from '@/store/rootState';
import Login from './module/login/login';
import register from './module/register/register';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    // 面包屑
    breadcrumb: [
      {
        path: '/work',
        breadcrumbName: '工作台'
      }
    ]
  },
  mutations: {
    // 切换面包屑
    changeBreadcrumb(state, payload) {
      console.log('接收到的面包屑', payload.breadcrumb);
      state.breadcrumb = payload.breadcrumb;
    }
  },
  getters: {
    doneChangeBreadcrumb: state => {
      return state.breadcrumb;
    }
  },
  actions: {},
  modules: {
    Login,
    register
  }
});
